//
//  ViewController.m
//  11203
//
//  Created by student on 16/3/3.
//  Copyright © 2016年 niit. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property (nonatomic,strong)NSArray *footballteam;
@property (nonatomic,strong)NSArray *images;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
   self.footballteam = [[NSArray alloc] initWithObjects:@"A1-南非",@"A2-墨西哥",
     @"B1-阿根廷",@"B2-尼日利亚",@"C1-英格兰",@"C2-美国",
     @"D1-德国",@"D2-澳大利亚",@"E1-荷兰",@"E2-丹麦",
     @"G1-巴西",@"G2-朝鲜",@"H1-西班牙",@"H2-瑞士",nil];
    self.images = [[NSArray alloc] initWithObjects:@"SouthAfrica.png",@"Mexico.png",
                   @"Argentina.png",@"Nigeria.png",@"England.png",@"USA.png",
                   @"Germany.png",@"Australia.png",@"Holland.png",@"Denmark.png",                      @"Brazil.png",@"NorthKorea.png",@"Spain.png",@"Switzerland.png",nil];
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.footballteam.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"];
    cell.textLabel.text = self.footballteam[indexPath.row];
    cell.imageView.image = [UIImage imageNamed:self.images[indexPath.row]];

    
    
    return  cell;
    
}


- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSInteger row = indexPath.row;
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"你要干啥去?" message:self.footballteam[row] preferredStyle:UIAlertControllerStyleAlert];
    UIAlertAction *action = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        [self dismissViewControllerAnimated:YES completion:nil];
    }];
    [alert addAction:action];
    
    [self presentViewController:alert animated:YES completion:nil];
}



@end
